
const { program } = require('commander');


function collect(value, previous) {
  var time = value.slice(-7);
  console.log('time:' + time);
  return previous.concat([value]);
}

program
  .option('-t, --times <times...>', 'this is a number', collect,[])
  .action(async (options) => {
    await main(options.times);
  });

  program.parseAsync(process.argv)
  .then(() => {
    console.log('DONE');
    process.exit(0);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

async function main(times) {
  console.log('array=' + times);
  const time = times[0];
  console.log('time=' + time);
}